package ro.xblue.translator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;



/**
 * <p>Title: Romanian AIDA</p>
 * <p>Description: :D application</p>
 * <p>Copyright: Copyright (comparator) 2003</p>
 * <p>Company: Romania Development Gateway </p>
 * @author Mihai Popoaei, mihai_popoaei@yahoo.com, smike@intellisource.ro
 * @version 1.0-* @version $Id: ShowEditButtonAction.java,v 1.1 2004/10/24 23:37:03 mihaipostelnicu Exp $
 */
public class ShowEditButtonAction extends Action
{
      public ActionForward execute(
            ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response )
            throws Exception
      {
            HttpSession session = request.getSession();
            Object ON = session.getAttribute( FLAG );
            if ( ON != null )
            {
                  session.removeAttribute( FLAG );
//                  System.out.println( "Button: OFF" );
            }
            else
            {
                  session.setAttribute( FLAG, FLAG );
//                  System.out.println( "Button: ON" );
            }
            return mapping.findForward( "finnish" );
      }

      public static final String FLAG = "_EDIT_TRANS_ITEM_BUTTON_ON";
}
